﻿
using System.IO;
using zyconfig;

namespace zymain
{
    class DeleteFile
    {
        private string _Guid = string.Empty;
        private string _tableName = string.Empty;

        public DeleteFile(string Guid, string tableName)
        {
            this._Guid = Guid;
            this._tableName = tableName;
        }

        public void DoWork()
        {
            string filePath = this.GetFilePath(this._Guid);
            if (File.Exists(filePath))
            {
                File.Delete(filePath);
            }
        }

        public string GetFilePath(string Guid)
        {
            string str3="";
            using (DbOperHandler _open = new Common().Doh())
            {
                _open.Reset();
                _open.ConditionExpress = " GUID='" + Guid + "' and 完成状态= 1";
                switch (this._tableName)
                {
                    case "0":
                        str3 = _open.GetField("Disk_文件信息表", "文件路径").ToString().Trim();
                        break;
                    case "1":
                        str3 = _open.GetField("Disk_复本文件信息表", "文件路径").ToString().Trim();
                        break;
                    case "2":
                        str3 = _open.GetField("DISK_情报检索文件信息表", "文件路径").ToString().Trim();
                        break;
                }
            }
            return str3;
        }
    }
}
